package com.mm.cme.kotlin_001.level02.i_000_function

import com.mm.cme.kotlin_001.utils.pd
import com.mm.cme.kotlin_001.utils.pl

/**
 * Descriptions：拉姆达表达式
 * <p>
 * Author：ChenME
 * Date：2017/7/16
 * Email：ibelieve1210@163.com
 */

val array_string: Array<String> = arrayOf("hello", "go", "1", "(", "*", ")")

fun main(args: Array<String>) {


    val arg1 = 1
    val arg2 = 10
    pl("$arg1 + $arg2 = ${getSum(arg1, arg2)}")

    printHello()

    pd()
    array_string.forEach {
        pl(it)
    }

    pd()
    array_string.forEach FOR_EACH@ {
        if (it == "go") return@FOR_EACH
        pl(it)
    }
    pl("The End")

    pd()
    pl(printHello)
    pl(printHello is () -> Unit)
}

val getSum = { arg1: Int, arg2: Int -> arg1 + arg2 }

val printHello = { pl("Hello China") }